package com.tengju.user.domain.model.archive.resume;

import com.tengju.user.domain.shared.ValueObject;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.Objects;

@Data
@AllArgsConstructor
public class CommunityInfo implements ValueObject<CommunityInfo> {

    /**
     * 微信账号
     */
    private String wechatId;

    /**
     * 好友数量
     */
    private Integer friendCount;

    /**
     * 视频号
     */
    private String videoId;

    /**
     * 群数量
     */
    private Integer groupCount;

    /**
     * 群人数
     */
    private Integer coveredPeople;

    @Override
    public boolean sameValueAs(CommunityInfo that) {
        return that != null && Objects.equals(wechatId, that.wechatId) &&
                Objects.equals(friendCount, that.friendCount) &&
                Objects.equals(videoId, that.videoId) &&
                Objects.equals(groupCount, that.groupCount) &&
                Objects.equals(coveredPeople, that.coveredPeople);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        CommunityInfo that = (CommunityInfo) o;
        return this.sameValueAs(that);
    }

    @Override
    public int hashCode() {
        return Objects.hash(wechatId, friendCount, videoId, groupCount, coveredPeople);
    }
}
